package memetic.operators;

import java.util.Random;

public class PopulationInitilization {

	private Random randomGenerator= new Random();
	//Attributes used in the method "initOneInd_MinorLength()"
	private int popS;
	public String[] initOneInd_PercentPop(String [] sentencesPopulation,int percentaje){
		for(this.popS=0;this.popS<sentencesPopulation.length;this.popS++){
			//Select the best sentences that fulfill the length requirement
			//highly complex
		}
		return null;
	}
	private int generateRandomValue(int end){
		return randomGenerator.nextInt(end);
	}
	/**
	 * @param int percentage A number between 0 and 100
	 */
	public int[] initOneInd_random_PercPop(String [] sentencesPopulation,float percentaje){
		int[] individual=new int[sentencesPopulation.length];
		int numSent=(int) (sentencesPopulation.length*percentaje/100);
		int sentPos=0;
		for(int i=0;i<numSent;i++){
			sentPos=generateRandomValue(sentencesPopulation.length);
			do{
				if(individual[sentPos]==0)
					individual[sentPos]=1;
				else{
					sentPos=generateRandomValue(sentencesPopulation.length);
					continue;
				}
			}while(individual[sentPos]==1);
		}
		return individual;
	}
}
